/*
 * @Date: 2022-03-29 16:56:53
 * @LastEditors: fenglan
 * @LastEditTime: 2022-03-29 18:48:14
 * @FilePath: /payment/pay/src/components/Echarts/index.jsx
 */
import React, { useEffect } from 'react'
import * as echarts from 'echarts';
import styles from './index.module.css'
import { Row, Col } from 'antd'
export default function Charts() {
  useEffect(() => {
    var Fan = echarts.init(document.getElementById('main'))
    Fan.setOption({
      title: {
        text: '代付业务统计图'
      },
      // backgroundColor: 'transparent',
      // color: ['#FFDD01'],
      tooltip: {
        trigger: 'axis'
      },
      legend: {
        data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
      },
      grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
      },
      toolbox: {
        feature: {
          saveAsImage: {}
        }
      },
      xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          name: 'Email',
          type: 'line',
          data: [820, 932, 901, 934, 1290, 1330, 1320],
          type: 'line',
          smooth: true,
          areaStyle: {
            //区域填充样式
            normal: {
              //线性渐变，前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’，则该四个值是绝对像素位置。
              color: echarts.graphic.LinearGradient(
                0,
                0,
                0,
                1,
                [
                  {
                    offset: 0,
                    color: "#1890ff",
                  },
                  {
                    offset: 1,
                    color: "#1890ff",
                  },
                ],
                false
              ),
            },
          }
        },
        {
          name: 'Video Ads',
          type: 'line',
          stack: 'Total',
          data: [0, 0, 0, 0, 0, 0, 0]
        },
        {
          name: 'Direct',
          type: 'line',
          stack: 'Total',
          data: [0, 0, 0, 0, 0, 0, 0]
        },
        {
          name: 'Search Engine',
          type: 'line',
          stack: 'Total',
          data: [0, 0, 0, 0, 0, 0, 0]
        }
      ]
    })
  })
  return (
    <div className={styles.body}>
      <Row >
        <Col span={24} id='main' className={styles.fan}>
        </Col>
      </Row>
    </div>
  )
}
